import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JLabel;

/**
 * Demo for CSE2102-001L Lab 1
 * @author ashishbillava
 *
 */
public class Lab1 extends JFrame
{
	public Lab1(String title)
	{
		super(title);
		this.setSize(500, 200);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		try 
		{
		    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) 
		    {
		        if ("Nimbus".equals(info.getName())) 
		        {
		            UIManager.setLookAndFeel(info.getClassName());
		            break;
		        }
		    }
		} 
		catch (Exception e) 
		{
		    System.out.println("No Nimbus L&F installed");		
		}
		
		JPanel newPanel = new JPanel();
		newPanel.setLayout(new BoxLayout(newPanel, BoxLayout.PAGE_AXIS));
		
		JLabel newLabel = new JLabel("Hello World!");
		
		newPanel.add(Box.createHorizontalStrut(110));
		newPanel.add(newLabel);
		newPanel.add(Box.createVerticalStrut(80));
		
		this.add(newPanel);
		
		this.setLocationRelativeTo(null);
		this.setVisible(true);
	}
	
	public static void main(String[] args)
	{
		Lab1 lab1 = new Lab1("Lab 1 Demo");
	}
}
